package com.vision.core.cl.ui;

import com.sencha.gxt.widget.core.client.TabPanel;
import com.vision.core.cl.CodeDownloadCallback;

/**
 * Callback used to create {@link ITabItemPanel} instances and add it to a {@link TabPanel}.
 * 
 * @author Mark
 *
 */
public abstract class TabItemPanelAdderCallback extends CodeDownloadCallback {
	
	private TabPanel tabPanel;
	private ITabItemPanel panel;
	
	public TabItemPanelAdderCallback(TabPanel tabPanel) {
		this.tabPanel = tabPanel;
	}
	
	@Override
	public void onSuccess() {
		createPanel();
		tabPanel.add(panel, panel.getConfig());
	}
	
	protected abstract void createPanel(); 
	
}